﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace QbservableCore.Serialization
{
    static internal class Binary
    {
        public static void ToJson(BinaryExpression node, ExpressionToJson state)
        {
            // set current as json array
            state.JsonCurrent = state.JsonCurrent as JArray ?? new JArray(); ;

            state.CreateAndTransform(node.Left, state.JsonCurrent);
            state.JsonCurrent.AddProperty(Consts.Json.Operator, node.NodeType, state);
            state.CreateAndTransform(node.Right, state.JsonCurrent);
        }
    }
}
